
use std::net::{UdpSocket, Ipv4Addr};



fn main() -> std::io::Result<()> {
    {
       let socket = UdpSocket::bind("0.0.0.0:8888")?;
       //let socket = UdpSocket::bind("0.0.0.0:12343")?;
       socket.join_multicast_v4(&Ipv4Addr::new(224, 0, 0, 88), &Ipv4Addr::new(0, 0, 0, 0))?;

       loop {
           let mut buf = [0; 10];
           let (amt, src) = socket.recv_from(&mut buf)?;
           println!("recv bytes:{}, buf:{}, src:{:?}", amt, std::str::from_utf8(&buf).unwrap(), src);
       }
    }
}

